package com.java.tutorials.jdk7.paths;
import java.net.URI;
import java.nio.file.FileSystems;
import java.nio.file.Path;
import java.nio.file.Paths;
/**
 * Created by xuzhike on 2016/1/27.
 * http://www.java2s.com/Code/Java/JDK-7/Convertingarelativepathintoanabsolutepath.htm
 * Converting a relative path into an absolute path
 */
public class Convertingarelativepathintoanabsolutepath {
    public static void main(String[] args) throws Exception {
        String separator;
        separator = FileSystems.getDefault().getSeparator();
        System.out.println("The separator is " + separator);

        Path path = Paths.get(new URI("file:///C:/home/docs/users.txt"));
        System.out.println("subpath: " + path.subpath(0, 3));
        path = Paths.get("/home", "docs", "users.txt");
        System.out.println("Absolute path: " + path.toAbsolutePath());
        System.out.println("URI: " + path.toUri());

    }
}
